function A=Matrix(filename);
A=0;
fid=fopen(filename,'r');
while 1
    while 1
        if feof(fid)
            return;
        end
        line=fgetl(fid);
        if isempty(line)|| line(1)=='#'
            continue;
        else
            break;
        end
    end
    data_temp=sscanf(line,'%d%d');
    row =data_temp(1);
    col =data_temp(2);
    format=repmat('%d',1,row);
    line=fgetl(fid);
    Sum_row=sscanf(line,format);
    format=repmat('%d',1,col);
    line=fgetl(fid);
    Sum_col=sscanf(line,format);
    %construct a graph
    V=1+row+col+1;
    Capacity=zeros(V,V);
    Capacity(1,2:1+row)=Sum_row';
    Capacity(1+row+1:1+row+col,V)=Sum_col;
    Capacity(2:1+row,1+row+1:1+row+col)=1;
    [C_f f]=Push_Relabel(Capacity);
    A=f(2:1+row,1+row+1:1+row+col);
    disp(A);
end
end